package com.fubowen.lepton.db.bean

import androidx.annotation.IntDef
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity
class Password @JvmOverloads constructor(
    @PrimaryKey(autoGenerate = true)
    var id: Int = 0,
    var title: String = "",
    var description: String? = null,
    var timestamp: Long = System.currentTimeMillis(),
    var password: String? = null,
    @Source
    var source: Int = SOURCE_TEXT,
    var encrypted: ByteArray? = null,
    var filePath: String? = null,
    var fileName: String? = null
) {
    companion object {
        const val SOURCE_TEXT = 2
        const val SOURCE_BOOKMARK = 4
        const val SOURCE_FILE = 8

        @IntDef(SOURCE_TEXT, SOURCE_BOOKMARK, SOURCE_FILE)
        @Retention(AnnotationRetention.SOURCE)
        annotation class Source
    }
}